# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  # Be sure to include AuthenticationSystem in Application Controller instead
  include AuthenticatedSystem
  # If you want "remember me" functionality, add this before_filter to Application Controller
  before_filter :login_from_cookie
  before_filter :load_blog
  
  # Pick a unique cookie name to distinguish our session data from others'
  session :session_key => '_uniblog_session_id'
  
  def load_blog
    @blog = Blog.find(:first)
  end
  
  def verify_access
    unless logged_in?
      redirect_to new_session_path
      return false
    end
  end
  
end
